<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>

<%@ page import="org.springframework.security.ui.AbstractProcessingFilter"%>
<%@ page import="org.springframework.security.ui.webapp.AuthenticationProcessingFilter"%>
<%@ page import="org.springframework.security.AuthenticationException"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>电信网络安全防护管理系统</title>
	<%@ include file="/common/meta.jsp"%>
	<link href="${ctx}/css/default.css" type="text/css" rel="stylesheet" />
	<link href="${ctx}/css/safeguard.css" type="text/css" rel="stylesheet" />
	<script src="${ctx}/js/jquery.js" type="text/javascript"></script>
	<script src="${ctx}/js/validate/jquery.validate.js" type="text/javascript"></script>
	<script src="${ctx}/js/validate/messages_cn.js" type="text/javascript"></script>
  	<script>
  		$(document).ready(function(){
    		//jquery's css demo, however, not work good
    		/*
	    	var cssObj = {
	    	'height':'35', 'width':'130', 'align':'middle'
	      	}
    		$("#jcaptcha_img").css(cssObj);
    		*/
    		$("#loginForm").validate();
    	});
    	
		function refreshCaptcha(){
				$('#captchaImg').html('<img id="jcaptchaImg" src="${ctx}/security/jcaptcha.jpg?'+Math.round(Math.random()*100000)+'"/>');
		}
  	</script>
</head>
<body>
	
		<%if ("1".equals(request.getParameter("error"))) {%>
			<span style="color:red"> 用户名密码错误,请重试.</span>
	<%}
			if ("2".equals(request.getParameter("error"))) {%>
			<span style="color:red"> 验证码错误,请重试.</span>
	<%}
			if ("3".equals(request.getParameter("error"))) {%>
			<span style="color:red"> 此帐号已从别处登录.</span>
	<%}%>
	<h2>电信网络安全防护管理系统</h2>
	<h3>--系统登录</h3>
	<form id="loginForm" action="${ctx}/j_spring_security_check" method="post">
		<table class="inputView">
			<tr>
				<td>用户名:</td>
				<td colspan="2">
					<input type='text' name='j_username' class="required"
					<s:if test="not empty param.error"> value='<%=session.getAttribute(AuthenticationProcessingFilter.SPRING_SECURITY_LAST_USERNAME_KEY)%>'</s:if>/>
				</td>
			</tr>
			<tr>
				<td>密码:</td>
				<td colspan="2"><input type='password' name='j_password' class="required" /></td>
			</tr>
			
			<tr>
				<td>验证码:</td>
				<td><input type='text' name='j_captcha' size='5' /></td>
				<td><span id="captchaImg" ><img id="jcaptchaImg" src="${ctx}/security/jcaptcha.jpg" /></span><a href="javascript:refreshCaptcha()">看不清楚换一张</a></td>
			</tr>
			<tr>
				<td colspan='3' align="center">
				<input value="登录" type="submit" />
				<a href="${ctx}/regist!regist1.action">用户注册</a>
				<a href="findPassword.jsp">忘记密码</a>
				</td>
			</tr>
		</table>
	</form>
	<div>
	<h2>some demo</h2><br/>
	<a href="fckTest.jsp" target="_blank">fckEditor Demo</a><br/>
	<a href="jfreechartDemo.jsp" target="_blank">JFreeChart Demo</a><br/>
	<a href="itextDemo.jsp" target="_blank">IText Demo</a><br/>
	</div>
</body>
</html>

